<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>执行工序编号</title>
    <meta name="viewport"
      content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../../../css/mui.min.css" rel="stylesheet" />
    <link href="../css/common.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="../../../css/preview.css" />
    <style>
      /* .mui-content>.mui-table-view:first-child {
          margin-top: 1px;
      } */
      /* .icon{
        width: 35px;
        vertical-align: middle;
        margin-right: 10px;
      } */
      /* .mui-table-view-cell:after {
          left: 45px;
          height: 1px;
      } */
      /* .mui-table-view-cell{
        padding: 11px 11px 11px 11px;
      } */
      /* .mui-table-view:after {
          left: 45px;
      } */
      /* .mui-bar{
		  background-color: #0082E6;
	  } */
      .uls {
        padding: 20px 20px;
        list-style: none;
        margin: 0;
      }

      .mui-table-view:after {
        height: 0;
      }

      .titles {
        /* font-weight: bold; */
        margin-bottom: 24px;
        display: flex;
        justify-content: space-between;
      }

      .img_s {
        display: inline-block;
        width: 20px;
        height: 20px;
        line-height: 20px;
        text-align: center;
        color: #fff;
        background-color: #0082E6;
        border-radius: 100%;
        /* background: url(../img/word.png) no-repeat; */
        /* background-size: 100%; */
        margin: auto 0;
      }

      .bocks {
        padding: 0 5px;
      }

      .areas {
        background-color: #F5F6F7;
        border: solid 1px #DCDCDC;
      }

      .imgss {
        float: left;
        margin-right: 10px;
      }

      .imgss img {
        width: 100%;
      }

      .signs {
        display: inline-block;
        width: 160px;
        height: 160px;
        border: solid 1px #3188FE;
        border-radius: 5px;
        margin-right: 10px;
        margin-bottom: 10px;
        position: relative;
        /* background-color: #D4E6FF; */
      }

      .signs img {
        width: 100%;
        height: 100%;
      }

      .uploads {
        display: inline-block;
        width: 160px;
        height: 160px;
        /* border-radius: 5px; */
        background: url(../img/task/dianjipaizhao.png) no-repeat;
        background-size: 100%;
        margin-bottom: 20px;
      }

      .uploadsign {
        display: inline-block;
        width: 160px;
        height: 160px;
        margin-bottom: 20px;
        background-color: #D4E6FF;
        border: dotted 2px #3188FE;
        text-align: center;
        line-height: 10rem;
      }

      .submits {
        width: 100%;
        margin-top: 30px;
        height: 4 0px;
        border-radius: 30px;
      }
	  /* .fixed-btn {
		display: flex;
		justify-content: flex-end;
	  } */
      .fixed-btn .mui-btn {
        width: 30%;
      }

      .putList {
        display: flex;
        justify-content: space-between;
        padding-bottom: 20px;
      }

      .putList input {
        width: 80%;
      }

      .tits {
        margin-bottom: 20px;
      }

      .radios .rs1 {
        left: 100px;
      }

      .radios .rs2 {
        left: 180px;
      }

      .oks {
        position: absolute;
        left: 130px;
        top: 10px;
      }

      .nos {
        position: absolute;
        left: 210px;
        top: 10px;
      }

      .checkradios {
        margin-bottom: 20px;
      }

      .marks {
        display: inline-block;
        /* width: 70px; */
        height: 26px;
        line-height: 26px;
        /* background-color: #10B7AF; */
        border-radius: 2px;
        color: #fff;
        text-align: center;
        transform: skewX(-15deg);
        padding: 0 10px;
      }

      .b_g1 {
        background-color: #FFD6D6;
      }

      .magTop {
        margin-top: 20px;
      }

      .tit {
        padding: 20px 0;
      }

      .sx_s {
        color: #fff;
      }

      .sx_s span {
        font-size: 17px;
      }

      .screens {
        position: absolute;
        top: 44px;
        left: 0;
        width: 100%;
        min-height: 200px;
        background-color: #fff;
        z-index: 999;
      }

      .content_ul {
        padding: 30px;
        overflow: hidden;
      }
      .content_ul .rowli{
        height: 300px !important;
      }
      .content_ul .rowli ul {
        padding: 0;
        margin: 0;
        list-style: none;
        border-bottom: solid 1px #DCDCDC;
        overflow: hidden;
        display: flex;
        flex-wrap: wrap;
        /* justify-content: space-between; */
      }

      .rowli ul li {
        width: 30px;
        height: 30px;
        text-align: center;
        line-height: 30px;
        background-color: #F5F6F7;
        border: solid 1px #C2CFDA;
        border-radius: 3px;
        color: #000;
        /* float: left; */
        margin-right: 20px;
        margin-bottom: 20px;
        box-sizing: border-box;
        /* flex-grow: 1; */
      }

      .rowli ul li.ls {
        background-color: #3188FE;
        color: #fff;
      }

      .btnli {
        text-align: center;
        padding-top: 30px;
        display: flex;
        justify-content: space-between;
      }

      .btnli .btns {
        background-color: #E7ECF1;
      }

      .btnli button {
        width: 45%;
      }

      .signs .action-delete {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        text-align: center;
      }

      .action-delete .mui-icon {
        color: #FFFFFF;
      }

      .tips {
        text-align: center;
        font-weight: bold;
        line-height: 40px;
        font-size: 18px;
        border-bottom: 1px solid #DCDCDC;
      }

      .option {
        display: flex;
        justify-content: space-around;
        margin-top: 20px;
      }

      .option button {
        width: 80px;
      }

      .option.justify-center {
        justify-content: center;
      }

      .tips-list {
        margin-top: 30%;
      }

      .mui-btn-gary {
        color: #FFF;
        border: 1px solid #cccc;
        background-color: #cccc;
      }

      .btn-active {
        border-style: dashed !important;
      }
    </style>
  </head>
  <body>
    <div id="container" v-cloak>
      <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left text-white"></a>
        <h1 class="mui-title">执行工序编号</h1>
        <a class="mui-pull-right mui-bar-right" @click="getSearch">
          <img src="../img/screen.png" width="18" style="margin-right: 3px;" />
          <span> 筛选</span>
        </a>
        <!-- <a class="mui-icon mui-icon-right-nav mui-pull-right mui-icon mui-icon-gear sx_s"
          @click="getSearch"><span>筛选</span></a> -->
      </header>
      <div class="mui-content page-wrap">
        <div class="mui-card-header" @tap="searchInfo()" style="padding: 20px;">
          <!-- <span class="img_s">1</span> -->
          <span>查询知识库</span>
        </div>
        <ul class="uls page-scroll" style="background: #fff;">
          <li class="lis" style="margin-bottom: 20px;">
            <div id="">
            	{{idxs + 1}}、{{currentIndex + 1}}/{{allWp.length}} {{detail.position ? '辅助工序': '基本工序'}} 
            </div>
            <div>
            	<span>工序编号：</span><span>{{detail.wpCode}}</span>
            </div>
            <div>
              <span>作业项目：</span><span>{{detail.jobProject}}</span>
            </div>
            <div>
              <span>作业方法：</span><span>{{detail.jobMethod}}</span>
            </div>
          </li>
          <li class="lis" v-for="(item,index) in projectList" :key="index" v-cloak>
            <!-- <img src="./img/xiaoxitongzhi_icon1.png" class="icon"> -->
            <div class="titles">
              <div>
                <span class="img_s">{{index+1}}</span>
                <span class="bocks">{{item.refInput.name}}
                  {{item.refInput.explain}}：{{inputShowText(item.refInput, dict)}}</span>
              </div>
              <span class="marks" :class="getTag(0, detail.tagId)">{{getTag(1, detail.tagId)}}</span>
            </div>
            <div v-if="!detail.isReturn">
              <div class="tits">{{item.refInput.name}}：</div>
              <div class="putList" v-if="item.refInput.typeValue == 'number'">
                <div>
                  <input type="number" v-model="item.value" class="val1" maxlength="20" /> {{item.refInput.unitValue}}
                </div>
              </div>
              <div v-if="item.refInput.typeValue == 'text'">
                <textarea type="text" v-model="item.remarks" class="areas" maxlength="200"></textarea>
              </div>
              <div v-if="item.refInput.typeValue == 'boolean'">
                <div class="mui-input-row mui-radio radios">
                   <label>选项(是否)：</label>
                   <input :name="'radio' + index + 1" v-model="item.value" :checked="item.value=='是'?true:false" type="radio" value="是" class="rs1">
                   <span class="oks">是</span>
                   <input :name="'radio' + index + 1" v-model="item.value" :checked="item.value=='是'?false:true" type="radio" value="否" class="rs2">
                   <span class="nos">否</span>
                 </div> 
              </div>
              <div class="upsign" v-if="item.refInput.typeValue == 'img'">
                <div v-if="item.files" class="imgss">
                  <span class="signs" v-for="(v,i) in item.files">
                    <img :src="v.path|| (baseUrl + v.filePath)" 
                    :data-preview-src="v.path|| (baseUrl + v.filePath)"
                      data-preview-group="anomaly" />
                    <!-- <img :src="v.filePath? baseUrl + v.filePath:''"
                      :data-preview-src="v.filePath?baseUrl + v.filePath:''" :data-preview-group="index" /> -->
                    <div class="action-delete" @tap="deleteImg(i, index, 1)">
                      <span class="mui-icon mui-icon-trash"></span>
                    </div>
                  </span>
                </div>
                <span class="uploads" @tap="addPics(index)"></span>
              </div>
            </div>

          </li>
          <li v-if="!detail.isReturn">
            <div class="checkradios">
              <div class="mui-input-row mui-radio radios isAnomaly">
                <label>是否正常：</label>
                <input name="radio1" :checked="detail.isAnomaly?true:false" type="radio" value="1" class="rs1">
                <span class="oks">否</span>
                <input name="radio1" :checked="detail.isAnomaly?false:true" type="radio" value="2" class="rs2">
                <span class="nos">是</span>
              </div>
            </div>
          </li>
          <li class="lis footers" v-if="fileimg">
            <div>
              <textarea name="" class="areas" v-if="anomalyInfo" v-model="anomalyInfo.remarks" cols="30" rows="3"
                maxlength="200"></textarea>
            </div>
            <div class="upsign">
              <div v-if="anomalyInfo&&anomalyInfo.files" class="imgss">
                <span class="signs" v-for="(v,index) in anomalyInfo.files">
                  <img :src="v.path|| (baseUrl + v.filePath)" :data-preview-src="v.path|| (baseUrl + v.filePath)"
                    data-preview-group="anomaly" />
                    <!-- <img :src="v.filePath" v-else :data-preview-src="v.filePath"
                    data-preview-group="anomaly"/> -->
                  <div class="action-delete" @tap="deleteImg(v, index,2)">
                    <span class="mui-icon mui-icon-trash"></span>
                  </div>
                </span>
              </div>
              <span class="uploads" @tap="addPic(2)"></span>
            </div>
          </li>
		  <hr size="1"/>
          <li v-if="!detail.isReturn">
            <div class="btn_s">
              <button type="button" @tap="defectsfn()"
                class="mui-btn mui-btn-danger">{{!detail.isFault?'生成缺陷':'取消缺陷'}}</button>
              <button type="button" @tap="equipmentList()" class="mui-btn mui-btn-primary">更换设备</button>
            </div>
          </li>
          <li v-if="detail.tagId && !detail.isReturn">
			<div style="color: red;margin-top:15px">相关负责人必须拍脸部以及签字，否则此工序为异常，不予通过</div>
            <div class="tit"><span>负责人拍照：</span></div>
            <div class="upsign">
              <div v-if="signInfo && signInfo.takeImg && signInfo.takeImg.filePath" class="imgss">
                <span class="signs">
                  <!-- <img class="takeImgs" :src="baseUrl + signInfo.takeImg.filePath" :data-preview-src="baseUrl + signInfo.takeImg.filePath" data-preview-group="sign" /> -->
                  <img class="takeImgs" :src="signInfo.takeImg.path || (baseUrl + signInfo.takeImg.filePath)" :data-preview-src="signInfo.takeImg.path || (baseUrl + signInfo.takeImg.filePath)" data-preview-group="sign" />
                  <div class="action-delete" @tap="deleteImgs(3)">
                    <span class="mui-icon mui-icon-trash"></span>
                  </div>
                </span>
              </div>
              <span class="uploads" @tap="addPic(3)"></span>
            </div>
          </li>
		   <hr size="1"/>
          <li v-if="detail.tagId && !detail.isReturn">
            <div class="tit"><span>签字(必填)</span></div>
            <div class="signs" id="sign" @tap="toSign" v-if="signInfo">
              <!-- <img id="signImg" style="width: 100%;height: 100%;"
                :src="signInfo.signImg && signInfo.signImg.filePath? baseUrl + signInfo.signImg.filePath:''"
                v-show="signInfo.signImg &&  signInfo.signImg.filePath" /> -->
                <img id="signImg" style="width: 100%;height: 100%;" :src="signInfo.signImg.img || (baseUrl + signInfo.signImg.filePath)" />
            </div>
            <div>点击图片修改签字</div>
            <!-- <span class="uploadsign mui-icon mui-icon-plusempty" @tap="toSign">点击签字</span> -->
          </li>
        </ul>
        <!--<div class="fixed-btn" style="justify-content:center;color: red;" v-if="detail.isReturn">
          此工序已退回
        </div>-->
        <div class="fixed-btn">
		  <button v-if="lineType" type="button" @tap="askback()" class="mui-btn mui-btn-danger mui-btn-outlined" v-if="!detail.isReturn">申请退回</button>
		  <button v-if="detail.isReturn" type="button" class="mui-btn mui-btn-danger mui-btn-outlined">已退回</button>
		  <!-- <button v-if="!lineType" type="button" @tap="saveInfo(true)" class="mui-btn mui-btn-danger mui-btn-outlined">保存离线数据</button> -->
		  <!-- <button v-if="detail.status == 4" type="button" @tap="saveOfflineData()" class="mui-btn mui-btn-danger mui-btn-outlined">提交离线数据</button> -->
          
          <button type="button" @tap.stop="prevInfo()" class="mui-btn mui-btn-primary mui-btn-outlined" v-if="idxs>0 || currentIndex> 0">上一个</button>
          <button type="button" @tap.stop="nextInfo()" class="mui-btn mui-btn-primary mui-btn-outlined" v-if="idxs<aList.length-1 || currentIndex < allWp.length - 1">下一个</button>
          <button type="button" @tap="saveInfo(false)" class="mui-btn mui-btn-primary" v-else-if="!detail.isReturn">保存</button>
        </div>
        <div class="screens mui-popover mui-popover-top">
          <div class="head_s mui-segmented-control mui-segmented-control-inverted mui-segmented-control-primary "
            style="background-color: #fff;">
            <a class="mui-control-item mui-active" href="#items1"><span class="txt">全部</span></a>
            <a class="mui-control-item" href="#items2"><span class="txt">已完成</span></a>
            <a class="mui-control-item" href="#items3"><span class="txt">未完成</span></a>
          </div>
          <div class="content_ul">
            <div class="rowli mui-slider-item mui-control-content mui-active" id="items1"> 
              <div class="mui-scroll-wrapper">
                <div class="mui-scroll">
                  <div>
                    <ul v-if="aList.length>0">
                      <li v-for="(v,index) in aList" :key="v.id" @tap="nextInfo(v.id, v.index)"
                        :class="[idxs == v.index? 'btn-active': '']">{{v.index+1}}</li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
            <div class="rowli mui-slider-item mui-control-content" id="items2">
              <div class="mui-scroll-wrapper">
                <div class="mui-scroll">
                  <div>
                    <ul v-if="yList.length>0">
                      <li v-for="(v,index) in yList" :key="v.id" @tap="nextInfo(v.id, v.index)"
                        :class="[idxs == v.index? 'btn-active': '']">{{v.index+1}}</li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
            <div class="rowli mui-slider-item mui-control-content" id="items3">
              <div class="mui-scroll-wrapper">
                <div class="mui-scroll">
                  <div>
                    <ul v-if="wList.length>0">
                      <li v-for="(v,index) in wList" :key="v.id" @tap="nextInfo(v.id, v.index)"
                        :class="[idxs == v.index? 'btn-active': '']">{{v.index+1}}</li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
            <div class="btnli">
              <button type="button" class="mui-btn btns" @tap="getSearch()">关闭</button>
              <button type="button" class="mui-btn mui-btn-primary" @tap="endSearch()">确认</button>
            </div>
          </div>
        </div>
      </div>
      <!-- tips -->
      <div class="mui-backdrop" v-show="isMask">
        <div class="tips-list">
          <div class="mui-card">
            <div class="tips">查询知识库</div>
            <div class="mui-card-content">
              <ul class="mui-table-view" v-if="dataList.length>0">
                <li class="mui-table-view-cell" v-for="(item,index) in dataList" :key="item.id" @tap="toDetails(item.id)">
                  <a class="mui-navigate-right">
                    <span>{{item.deviceModelName}}</span> -
                    <span>{{item.machineModel}}</span><br />
                    <span>{{item.title}}</span>
                  </a>
                </li>
              </ul>
              <div v-else>暂无数据</div>
            </div>
            <div class="mui-card-footer">
              <div></div>
              <button type="button" class="mui-btn" @click="isMask=false">关闭</button>
              <!--<button type="button" class="mui-btn mui-btn-primary">确定</button>-->
            </div>
          </div>
        </div>
      </div>
    </div>
    <script src="../../../js/mui.js"></script>
    <script src="../../../js/mui.pullToRefresh.js"></script>
    <script src="../../../js/mui.pullToRefresh.material.js"></script>
    <script src="../../../js/jquery-1.7.2.min.js"></script>
    <script src="../../../js/vue.js"></script>
    <!--<script src="../js/main.js"></script>-->
    <script src="../js/mkeyplus.base.js"></script>
    <script src="../js/uploadImage.js"></script>
    <script src="../js/sqlite.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../../js/mui.zoom.js"></script>
    <script src="../../../js/mui.previewimage.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/indexDBs.js"></script>
    <script type="text/javascript">
      mui.init();
      mui.previewImage();
      var ids = 1;
      var tagId = 271;
      var fileId = '';
      var idxs = 0;
      var dbId = 0;
      var dict = {};
      var self = null;
      let lineType=null;
      let db={};
      const dbName = 'myDBs'; // 数据库的名字
      const storeName = 'listPackage'; //仓库名称
      let lineDetails= {};
      // var dict=dict
      // materialsthis anomalyInfo
      let faultInfo = null;
      let materialsthis = null;

      if (window.plus) {
        plusready();
      } else {
        document.addEventListener('plusready', plusready, false);
      }
     async function plusready() {
        self = plus.webview.currentWebview();
        console.log('pram', self)
        // vm.form.projectTaskId = self.projectTaskId
        // vm.form.projectCategory = self.projectCategory
        ids = self.projectTaskId;
        tagId = self.tagId;
        dbId = self.dbId;
        vm.idxs = self.idxs;
        vm.aList = self.aList;
        vm.lineType = getSysInfo();
        lineType = getSysInfo();
        await openDB(dbName, storeName, 1).then(res=>{
          console.log('openDB',res)
          db = res
        })
        // vm.getDetail()
        // if(anomalyInfo){
        //   vm.anomalyInfo=anomalyInfo
        // }
         
        mui.baseApp.getDict(['valueUnit', 'valueType', 'inputSymbol', 'wpTag']).then(res => {
          console.log("-------------")
          console.log(res)
          vm.dict = res
          dict = res
          vm.wpTagList = res.wpTag
        })
		
		// 是否离线
        if(!lineType){
			getLineData()
			// getCacheData()
        } else {
			// 有网有离线数据
			getDataByKey(db, storeName,dbId).then(res=>{
				console.log('是否有离线数据',res)
				if(res == undefined){
					getProject()
					vm.getLists()
					vm.isOnlineAndOfflineData = false
				} else {
					getLineData()
					vm.lineType = lineType = false
					vm.isOnlineAndOfflineData = true
				}
			})
		}
        mui('.mui-scroll-wrapper').scroll();
      }

      var vm = new Vue({
        el: '#container',
        data: {
		  isOnlineAndOfflineData: false,
          idxs: 0,
          fileimg: false,
          isMask: false,
          dataList: [],
          detail: {},
          projectList: [],
          anomalyInfo: {
			id: '',
            remarks: '',
            files: [],
          },
          faultInfo: {
			id: '',
            remarks: '',
            files: [],
          },
          materialsthis: [],
          dict: dict,
          wpTagList: [],
          signInfo: {
            takeImg: {},
            signImg: {}
          },
          aList: [],
          yList: [],
          wList: [],
          allList: [],
          images: [],
          baseUrl: mui.baseApp.serverUrl,
          allWp: [], //当前基本工序加辅助工序
          currentIndex: 0, //当前基本工序加辅助工序所在索引
          lineType: null,
          lxDatas:{},
          lineDetails:{},
          listDatas:{}
        },
        computed: {
          headers() {
            return function(item, i) {
              return item.value ? item.value.split(',')[i] : ''
            }
          }
        },
        created: function() {
          // this.getWpTag()
        },
        methods: {
          validate(num, type) {
            //num 是否自动保存
            if(this.detail.isReturn) { //工序已退回
              return false
            }
			
            let isFill = false //是否存在填写项
            let isNoFill = false //是否存在未填写项
            this.projectList.forEach(res => {
				// if(res.value == '' || res.value == null){
				// 	mui.toast('请选择选项值(是否)')
				// 	isNoFill = true
				// }
              if(res.refInput.typeValue == 'number' || res.refInput.typeValue == 'boolean') {
                 if(res.value || res.value === 0) {
                   isFill = true
                 } else {
                   isNoFill = true
                 }
               }
               if(res.refInput.typeValue == 'text') {
                 if(res.remarks) {
                   isFill = true
                 } else {
                   isNoFill = true
                 }
                 
               }
               if(res.refInput.typeValue == 'img') {
                 if(Array.isArray(res.files) && res.files.length) {
                   isFill = true
                 } else {
                   isNoFill = true
                 }
                 
               }
            })
            if(this.projectList.length === 0) { //没有输入值 默认已输入
              isFill = true
            }
            if((isFill && isNoFill) || (!num && isNoFill)) { //同时存在输入项和未输入项   或 手动保存存在未输入项
              mui.toast('请完善输入值信息')
              return false
            }
            if(this.fileimg) {
              if(!this.anomalyInfo.remarks) {
                mui.toast('请填写不正常信息')
                return false
              }
//            if(!this.anomalyInfo.files.length) {
//              mui.toast('请上传异常图片')
//              return false
//            }
            }
			
            if(this.detail.tagId) {			  
              // 填了或选择了异常
              if(!this.signInfo.takeImg.filePath) {
                mui.toast('请上传负责人拍照信息')
                return false
              }
              if(!this.signInfo.signImg.filePath) {
                mui.toast('请负责人签字')
                return false
              }
              
            }
			
            if(num && !isFill && type == 'save') {
              return false
            }
            return true
          },
          saveInfo(num) {
            console.log('编辑数据', JSON.stringify(this.projectList))
            console.log('编辑离线数据', this.lxDatas)
            let then = this
			
            return new Promise((resolve, reject) => {
              if(!this.validate(num, 'save')) {
                resolve()
                // return
              }
			  
              let parm = {
                stage: 3,
                inputs: this.projectList,
                anomalyInfo: this.anomalyInfo,
                materials: this.materialsthis,
                faultInfo: this.faultInfo,
                isAnomaly: this.fileimg == true ? true : false,
                isFault: this.detail.isFault,
                isReturn: this.detail.isReturn,
                isRectify: this.detail.isRectify,
                isPass: this.detail.isPass,
                signInfo: this.signInfo
              }
			  
              let ajaxName = 'wp'
              if(this.detail.position) { //辅助工序
                parm.projectTaskSubWpId = vm.allWp[vm.currentIndex].projectTaskSubWpId
                ajaxName = 'subWp'
              } else {
                parm.projectTaskWpId = ids
              }
              
             //辅助工序的切换不走接口  保存提交时参数
              Object.assign(vm.allWp[vm.currentIndex], parm)
			  // 离线数据编辑
              if(!lineType || vm.isOnlineAndOfflineData){
                mui.confirm('当前是离线数据，是否需要保存编辑内容？','提示',['是','否'],function(item){
                  console.log('对话框提示',item)
                  if(item.index==0){
					plus.nativeUI.showWaiting('工序保存中...');
                    if(then.detail.position) {
                      if(lineDetails.subWps&&lineDetails.subWps.length>0){
                        lineDetails.subWps.forEach((item,i)=>{
                          if(item.projectTaskSubWpId==then.detail.projectTaskSubWpId){
                            lineDetails.subWps[i]=Object.assign(item,parm)
                            lineDetails.subWps[i].status=4
                            then.$set(lineDetails.subWps,i,Object.assign(item,parm))
                            // this.$set(lineDetails.details.subWps,i,Object.assign(item,parm))
                          }
                        })
                      }
                    }else{
                      lineDetails= Object.assign(lineDetails,parm)
                      then.listDatas.status=4
                      lineDetails.status=4
                    }
                    // then.detail.status=4
                    // 更新离线缺陷状态
                    vm.lxDatas.wpItemList.forEach((item,index)=>{
                      item.childs.forEach((item_a,index)=>{
                        item_a.childs.forEach((item_b,index)=>{
                          item_b.taskWps.forEach((item_c,index)=>{
                            //console.log(111,item_c.code,vm.detail.wpCode)
                            if(parm.isFault && item_c.code == vm.detail.wpCode){
                              item_c.isFault = true
                            }else{
                              item_c.isFault = false
                            }
                          })
                        })
                      })
                    })
                    console.log('编辑数据22000111', then.lxDatas)
					
                    getUpdata(then.lxDatas,num)
					plus.nativeUI.closeWaiting();
					
                    resolve(parm)
                    // getLineData()
                  }
                })
              }else{
				  plus.nativeUI.showWaiting("工序提交中...")
				  // 删除提交参数path
				  parm.inputs.forEach((a,i)=>{
					a.files === null ? [] :
					a.files.forEach((b,i)=>{
					    delete a.files[i].path;  
					})
				  })
				  if(parm.signInfo !== undefined){
				  	delete parm.signInfo.takeImg.path
				  }
				  // console.log(222,parm)
				  // return
				  mui.baseApp.httpRequst("post", "/app/api/project/execution/" + ajaxName + "/execution", parm, function(data) {
				  	console.log('数据列表', data)
				  	plus.nativeUI.closeWaiting();
				  	if (data.code == '0') {
				  	  mui.toast("保存成功")
				  	 //  mui.fire(self.opener(), 'back', {
				  		// back: 1
				  	 //  })
					  let listPage = plus.webview.getWebviewById('./riskList.html')
					  let detailPage = plus.webview.getWebviewById('./carryoutToDoDetail.html')
					  if (listPage) {
					  	mui.fire(listPage, 'back', {}) 
					  }
					  if (detailPage) { 
					  	mui.fire(detailPage, 'back', {})
					  }
					  if (!num) {
					    mui.back()
					  }
				  	} else {
				  	  mui.toast(data.msg)
				  	  reject()
				  	}
					resolve(parm)
				  }, ()=> {
				  	plus.nativeUI.closeWaiting()
				  	// mui.toast("保存失败")
				  	console.log("获取数据失败");
				  	reject()
				  })
				  
			  }
			  // console.log('ok编辑数据22000', JSON.stringify(then.lxDatas))
            })
            
          },
          searchInfo() {
            this.isMask = true
            // /app/api/project/execution/wpKnowledge/{projectTaskWpId}

          },
          getInfo() {
            let that = this;
            mui.baseApp.httpRequst("get", "/app/api/project/execution/wpKnowledge/" + ids, {}, function(data) {
              console.log('知识库', data)
              if (data.code == '0') {
                that.dataList = data.data
              } else {
                mui.toast(data.msg)
              }
            })
          },
          toDetails(id){
            mui.baseApp.openWindow("../knowledge/device/detail.html",{
              ids: id,
             })
          },
          askback() {
            let than=this
            vm.lineType= getSysInfo();
            lineType = getSysInfo();
            mui.confirm('因您不能执行此工序，需要退回整条工序 ', '提示', ['取消', '确定'], function(v) {
              // alert('12')
              console.log(v, '1223')
              if (v.index === 1) {
                if(!lineType){
                  // 获取离线数据
                   // than.detail.isReturn = true
                   lineDetails.isReturn = true
                   than.listDatas.isReturn = true
                   getUpdata(than.lxDatas)
                   return false
                }
                mui.baseApp.httpRequst("get", "/app/api/project/execution/return/" + ids, {}, function(data) {
                  console.log('回退', data)
                  plus.nativeUI.closeWaiting();
                  if (data.code == '0') {
                    console.log('回退123', data)
                    mui.toast(data.msg)
                    mui.fire(self.opener(), 'back', {
                      back: 1
                    })
                    mui.back()
                  } else {
                    mui.toast(data.msg)
                  }

                }, function(err) {
                  console.log('asss', err)
                  // plus.nativeUI.closeWaiting()
                  console.log("获取数据失败");
                })
              }
            })

          },
          getTag(v, tagId) {
            if (!tagId) {
              return ''
            }
            let tags = this.wpTagList.find(res => {
              // console.log('in',res,res.id,tagId)
              if (res.id == tagId) {
                return res
              }
            })
            // console.log('23',tags)
            if (tags) {
              if (tags.label == "停工待检点") {
                return v == 0 ? 'b_g1' : '停工待检点'
              } else if (tags.label == "现场见证点") {
                return v == 0 ? 'b_g2' : "现场见证点"
              } else if (tags.label == "旁站点") {
                return v == 0 ? 'b_g3' : "旁站点"
              } else if (tags.label == "技术监督") {
                return v == 0 ? 'b_g4' : "技术监督"
              }
            }
            // return tags
          },
          getWpTag() {
            mui.baseApp.httpRequst("post", "/app/sys/dictItem/getDictDetail", {
              dictName: 'wpTag'
            }, function(data) {
              console.log('数据列表wpTag', data)
              vm.wpTagList = data.data
            }, function() {
              // plus.nativeUI.closeWaiting()
              console.log("获取数据失败");
            })
          },
          nextInfo(vid, index) {
			// 是否离线
			if(!lineType){
			  console.log('item-id',ids)
			  this.saveInfo(true).then(res => {
			    // ids = ids + 1
				if(vm.currentIndex + 1 < vm.allWp.length) {
				  vm.currentIndex++
				  handleData({
				    data: vm.allWp[vm.currentIndex]
				  })
				  if(noId) { //没有ID保存完重新请求接口
				    if(!lineType){
				      getLineData()
				    }
				  }
				}
				if (this.aList.length > 1 && this.aList.length > vm.idxs + 1) {
					vm.idxs++
					ids = this.aList[vm.idxs]['id']
				}
				getLineData()
			  })
			  
			} else {
				
				if(!this.detail.isReturn) { //不是退回
				  if(!this.validate(true)) {
				    return
				  }
				  
				  this.saveInfo(true).then(res => {
				    let noId = false
				    if(res && res.inputs) {
				      res.inputs.forEach(item => {
				        if(!item.id) {
				          noId = true
				        }
				      })
				    }
				    this.nextFun(vid, index, noId)
				  })
				}
				// this.nextFun(vid, index)
			}

          },
          nextFun(vid, index, noId) {
            if (vid) {
              vm.idxs = index
              ids = vid
              if(!lineType){
                getLineData()
                mui('.screens').popover('toggle');
                return
              }
              getProject()
              mui('.screens').popover('toggle');
            } else {
              if(vm.currentIndex + 1 < vm.allWp.length) {
                vm.currentIndex++
                handleData({
                  data: vm.allWp[vm.currentIndex]
                })
                if(noId) { //没有ID保存完重新请求接口
                  if(!lineType){
                    getLineData("cancel")
                    return
                  }
                  getProject("cancel")
                }
                return
              }
              if (this.aList.length > 1 && this.aList.length > vm.idxs + 1) {
                vm.idxs++
                ids = this.aList[vm.idxs]['id']
                // this.saveInfo()
                if(!lineType){
                  getLineData()
                  return
                }
                getProject()
                 
              } else {
                mui.toast('没有了')
              }

            }
          },
          prevInfo() {
            if(!this.detail.isReturn) {//不是退回
              if(!this.validate(true)) {
                return
              }
              this.saveInfo(true).then(res => {
                let noId = false
                if(res && res.inputs) {
                  res.inputs.forEach(item => {
                    if(!item.id) {
                      noId = true
                    }
                  })
                }
                this.prevFun(noId)
              })
              // return
            }
			//this.prevFun()
            
          },
          prevFun(noId) {
            if(vm.currentIndex > 0) {
              vm.currentIndex--
              handleData({
                data: vm.allWp[vm.currentIndex]
              })
              if(noId) { //没有ID保存完重新请求接口
                if(!lineType){
                  getLineData("cancel")
                  return
                }
                getProject("cancel")
              }
              return
            }
            if (vm.idxs > 0) {
              vm.idxs--
              ids = this.aList[vm.idxs]['id']
              // this.saveInfo()
              if(!lineType){
                getLineData()
                return
              }
              getProject()
            } else {
              mui.toast('没有了')
            }
          },
          getLists() {
            vm.wList = []
            vm.yList = []
            this.aList.forEach((res) => {
              if (res.status == 0 || res.status == 1) {
                vm.wList.push(res);
              } else {
                console.log('idds12', res)
                vm.yList.push(res);
              }
            })
          },
          getSearch() {
            mui('.screens').popover('toggle');
            // this.searchs=!this.searchs
          },
          endSearch() {
            let h = $(".head_s .mui-active").attr('href')
            if (h == '#items1') {
              this.allList = this.aList;
            } else if (h == '#items2') {
              this.allList = this.yList;
            } else if (h == '#items3') {
              this.allList = this.wList;
            }
            mui('.screens').popover('toggle');
          },
          toSign() {
            mui.baseApp.openWindow('../common/sign.html', {
              projectId: ids
            })
          },
          defectsfn() {
            var than = this
            if (!this.detail.isFault) {
              mui.baseApp.openWindow('./defect.html', {
                projectId: ids,
                faultInfo: than.faultInfo
              })
            } else {
              mui.confirm('确定要取消生成缺陷吗？', '提示', ['取消', '确认'], function(e) {
                console.log(e.index)
                if (e.index === 1) { // 确认
                  than.detail.isFault = false
                } else {
                  console.log('取消')
                }
              }, 'div');

            }

          },
          equipmentList() {
            mui.baseApp.openWindow('./materialList.html', {
			        taskId: dbId,
              projectId: ids,
              materials: this.materialsthis
            })
          },
          // 添加图片
          addPics(index) {
            var that = this;

            page.imgUp(function(path) {
              console.log('compress image path: ' + path)

              plus.nativeUI.showWaiting('上传中')
              if(!lineType){
                if (that.projectList[index].files) {
                  that.projectList[index].files.push({
                    // fileId: res.data.id,
                    filePath: path,
                    path: path
                  })
                } else {
                  that.projectList[index].files = [{
                    // fileId: res.data.id,
                    filePath: path,
                    path: path
                  }]
                }
                plus.nativeUI.closeWaiting()
                return
              }
              mui.baseApp.upLoadFile(path, function(res) {
                console.log(res)
                plus.nativeUI.closeWaiting()
                mui.toast("上传成功")
                if (that.projectList[index].files) {
                  that.projectList[index].files.push({
                    fileId: res.data.id,
                    filePath: res.data.fileDirectory,
                    path: path
                  })
                } else {
                  that.projectList[index].files = [{
                    fileId: res.data.id,
                    filePath: res.data.fileDirectory,
                    path: path
                  }]
                }

              })
            });
          },
          // 添加图片
          addPic(index) {
            var that = this;
            lineType = getSysInfo();
            this.lineType = getSysInfo();
            if(index == 3) { //负责人拍照
              mui.baseApp.camera().then(path => {
                plus.nativeUI.showWaiting('上传中')
                console.log('pppzzzz',JSON.stringify(path))
                if(!lineType){
                  that.signInfo.takeImg = {
                    // fileId: res.data.id,
                    filePath: path,
                    path: path
                  }
                  plus.nativeUI.closeWaiting()
                  return
                }
                mui.baseApp.upLoadFile(path, function(res) {
                  console.log(res)
                  plus.nativeUI.closeWaiting()
                  mui.toast("上传成功")
                  that.signInfo.takeImg = {
                    fileId: res.data.id,
                    filePath: res.data.fileDirectory,
                    path: path
                  }
                }, function(err) {
                  plus.nativeUI.closeWaiting()
                })
              })
              return
            }
            page.imgUp(function(path) {
              console.log('compress image path: ' + path)
              plus.nativeUI.showWaiting('上传中')
              if(!lineType){
                if (index == 3) {
                  that.signInfo.takeImg = {
                    // fileId: res.data.id,
                    filePath: path,
                    path: path
                  }
                
                } else if (index == 2) {
                 // mui.baseApp.compressImage(path).than(aa => {
                 //   console.log('base64ToPath',JSON.stringify(aa))
                 // })
                    that.anomalyInfo.files.push({
                      // img: path,
                      // fileId: res.data.id,
                      filePath: path,
                      path: path
                    })
                   
                }
                plus.nativeUI.closeWaiting()
                return
              }
              mui.baseApp.upLoadFile(path, function(res) {
                console.log(res)
                plus.nativeUI.closeWaiting()
                mui.toast("上传成功")
                if (index == 3) {
                  that.signInfo.takeImg = {
                    fileId: res.data.id,
                    filePath: res.data.fileDirectory,
                    path: path
                  }

                } else if (index == 2) {
                  that.anomalyInfo.files.push({
                    img: path,
                    fileId: res.data.id,
                    filePath: res.data.fileDirectory,
                    path: path
                  })
                }
              })

              // var images = that.checkDetails[index].images;
              // images.push(path);
              // that.$set(that.checkDetails[index], 'images', images);
            });
          },
          // 删除图片
          deleteImg(v, index, i) {
            var that = this;
            mui.confirm('确定要删除此图片吗？', '提示', ['取消', '确认'], function(e) {
              console.log(e.index)
              if (e.index === 1) { // 确认
                if (i == 2) {
                  that.anomalyInfo.files.splice(index, 1)
                  // var images = that.checkDetails[index].images;
                  // images.splice(i, 1);
                  //                	that.$set(that.anomalyInfo.files, 'filePath', Path);
                } else if (i == 1) {
                  var images = that.projectList[index].files
                  images.splice(v, 1);
                  //                  that.$set(that.projectList[index], 'images', images);
                }

              } else {
                console.log('取消删除')
              }
            }, 'div');
          },
          // 删除图片
          deleteImgs(i) {
            var that = this;
            mui.confirm('确定要删除此图片吗？', '提示', ['取消', '确认'], function(e) {
              console.log(e.index)
              if (e.index === 1) { // 确认
                var images = that.signInfo.takeImg.filePath = ''
                // var images = that.checkDetails[index].images;
                // images.splice(i, 1);
                that.$set(that.signInfo.takeImg, 'filePath', images);
              } else {
                console.log('取消删除')
              }
            }, 'div');
          },
          showValue2(obj, dict) {
            if (!obj.typeSubId) {
              return false
            }
            let types = dict.id.inputSymbol[obj.typeSubId].value // 符号
            let typeSub = ['()', '[]', '(]', '[)', ')(', '][', ')[', '](']
            return typeSub.includes(types)
          },
          inputShowText(obj, dict) {
            // console.log(222,obj)
            let type = dict.id.valueType[obj.typeId].value // 类型
            if (type == 'text') {
              return obj.value
            } else if (type == 'img') {
              return '无'
            } else if (type == 'boolean') {
              return '是否'
            } else {
              let unit = dict.id.valueUnit[obj.unitId].value // 单位
              let symbol = dict.id.inputSymbol[obj.typeSubId].value // 符号
              let valueArr = obj.value.split(",")
              let showText = ''
              switch (symbol) {
                case '>':
                  showText = '>' + valueArr[0] + unit
                  break;
                case '≥':
                  showText = '≥' + valueArr[0] + unit
                  break;
                case '<':
                  showText = '<' + valueArr[0] + unit
                  break;
                case '≤':
                  showText = '≤' + valueArr[0] + unit
                  break;
                case '=':
                  showText = '=' + valueArr[0] + unit
                  break;
                case '!=':
                  showText = '!=' + valueArr[0] + unit
                  break;
                case '()':
                  showText = '>' + valueArr[0] + unit + '  ' + '<' + valueArr[1] + unit
                  break;
                case '[]':
					console.log(33,valueArr)
                  showText = '≥' + valueArr[0] + unit + '  ' + '≤' + valueArr[1] + unit
                  break;
                case '(]':
                  showText = '>' + valueArr[0] + unit + '  ' + '≤' + valueArr[1] + unit
                  break;
                case '[)':
                  showText = '≥' + valueArr[0] + unit + '  ' + '<' + valueArr[1] + unit
                  break;
                case ')(':
                  showText = '<' + valueArr[0] + unit + '  ' + '>' + valueArr[1] + unit
                  break;
                case '][':
                  showText = '≤' + valueArr[0] + unit + '  ' + '≥' + valueArr[1] + unit
                  break;
                case ')[':
                  showText = '<' + valueArr[0] + unit + '  ' + '≥' + valueArr[1] + unit
                  break;
                case '](':
                  showText = '≤' + valueArr[0] + unit + '  ' + '>' + valueArr[1] + unit
                  break;
                default:
                  showText = obj.value + unit
                  break
              }
              return showText
            }
          }
        },
      })

      function showValue2(obj, dict) {
        let types = dict.id.inputSymbol[obj.typeSubId].value // 符号
        let typeSub = ['()', '[]', '(]', '[)', ')(', '][', ')[', '](']
        return typeSub.includes(types)
      }
	  
      function getProject(type) {
        plus.nativeUI.showWaiting('加载中')
        mui.baseApp.httpRequst("get", "/app/api/project/execution/wp/detail/" + ids, null, function(data) {
          console.log('数据列表', data)
          plus.nativeUI.closeWaiting();
          if(data.data.status != 3) { // status3 代表当前登录人退回   isReturn 代表当前工序有退回记录  退回换执行人  isReturn不变  手动变为false
            data.data.isReturn = false
          }
          let subWps = data.data.subWps
          let prefix = []; // 前置
          let suffix = []; // 后置
          subWps.forEach(item => {
            item.isReturn = data.data.isReturn 
            if(item.position == 1) {
              prefix.push(item)
            } else {
              suffix.push(item)
            }
          })
          delete data.data.subWps
          vm.allWp = prefix.concat([data.data]).concat(suffix)
          if(type != 'cancel') {
            vm.currentIndex = 0
          }
          handleData({
            data: vm.allWp[vm.currentIndex]
          })
        }, function() {
          plus.nativeUI.closeWaiting()
          console.log("获取数据失败");
        })
        
        vm.getInfo()
      }
      
      function handleData(data) {
        vm.detail = data.data
        let lists = data&&data.data.inputs.map(res => {
          return res
        })
        console.log('新数据列表', lists)
        
        vm.projectList = lists
        vm.anomalyInfo = data.data.anomalyInfo ? data.data.anomalyInfo : {
            remarks: '',
            files: []
          },
          vm.materialsthis = data.data.materials ? data.data.materials : []
        vm.faultInfo = data.data.faultInfo ? data.data.faultInfo : {
          remarks: '',
          files: []
        }
        vm.signInfo = data.data.signInfo ? data.data.signInfo : {
          takeImg: {},
          signImg: {}
        }
        if (data.data.isAnomaly) {
          vm.fileimg = true
        } else {
          vm.fileimg = false
        }
      }
      function getCacheData(){
        getDataByKey(db, storeName,dbId).then(res=>{
			console.log('缓存',ids,res)
          vm.lxDatas=res
          let data={}
          res.wpItemList.forEach(msg=>{
            if(msg.childs&&msg.childs.length>0){
              msg.childs.forEach(item=>{
                if(item.childs&&item.childs.length>0){
                  item.childs.forEach(v=>{
                     console.log('ok3',v)
                    if(v.childs&&v.childs.length>0){
                      console.log('ok4',v.childs)
                    }
                    if(v.taskWps&&v.taskWps.length>0){
                       v.taskWps.forEach(c=>{
                         if(c.id==ids){
                           console.log('ccc',c.details)
                           vm.listDatas=c
                           data=c.details
						   vm.detail = data
                         }
                       })
                    }
                  })
                }
                if(item.taskWps&&item.taskWps.length>0){
                   item.taskWps.forEach(b=>{
                     if(b.id==ids){
                       console.log('bbb',b.details)
                       vm.listDatas=b
                       data=b.details
                     }
                   })
                }
              })
            }
            if(msg.taskWps&&msg.taskWps.length>0){
               msg.taskWps.forEach(a=>{
                 if(a.id==ids){
                   console.log('aaa',a.details)
                   vm.listDatas=a
                   data=a.details
                 }
               })
            }
          })
          lineDetails=data
          // vm.lineDetails=data
        })
      }
      function getLineData(type){
        console.log('离线id',ids,dbId)
        getDataByKey(db, storeName,dbId).then(res=>{
           plus.nativeUI.closeWaiting(); 
          // console.log('获取离线数据',JSON.stringify(res),res.wpItemList)
          vm.lxDatas=res
          let data={}
          res&&res.wpItemList&&res.wpItemList.forEach(msg=>{
            if(msg.childs&&msg.childs.length>0){
              msg.childs.forEach(item=>{
                if(item.childs&&item.childs.length>0){
                  item.childs.forEach(v=>{
                     console.log('ok3',v)
                    if(v.childs&&v.childs.length>0){
                      console.log('ok4',v.childs)
                    }
                    if(v.taskWps&&v.taskWps.length>0){
                       v.taskWps.forEach(c=>{
                         if(c.id==ids){
                           console.log('ccc',c.details)
                           vm.listDatas=c
                           data=c.details
                         }
                       })
                    }
                  })
                }
                if(item.taskWps&&item.taskWps.length>0){
                   item.taskWps.forEach(b=>{
                     if(b.id==ids){
                       console.log('bbb',b.details)
                       vm.listDatas=b
                       data=b.details
                     }
                   })
                }
              })
            }
            if(msg.taskWps&&msg.taskWps.length>0){
               msg.taskWps.forEach(a=>{
                 if(a.id==ids){
                   console.log('aaa',a.details)
                   vm.listDatas=a
                   data=a.details
                 }
               })
            }
          })
          lineDetails = data
          // console.log('离线idssssssssssssssssssssssssss',JSON.stringify(lineDetails))
          // vm.lineDetails=data
          let datas ={...data}
          if(datas.status != 3) { // status3 代表当前登录人退回   isReturn 代表当前工序有退回记录  退回换执行人  isReturn不变  手动变为false
            datas.isReturn = false
          }
          let subWps = datas.subWps
          let prefix = []; // 前置
          let suffix = []; // 后置
         subWps&&subWps.length?subWps.forEach(item => {
            item.isReturn = datas.isReturn 
            if(item.position == 1) {
              prefix.push(item)
            } else {
              suffix.push(item)
            }
          }):[]
          delete datas.subWps
          vm.allWp = prefix.concat([datas]).concat(suffix)
		  console.log(22,vm.allWp)
          if(type != 'cancel') {
            vm.currentIndex = 0
          }
          handleData({
            data: vm.allWp[vm.currentIndex]
          })
        })
      }
     function getUpdata(lxDatas,num){
        updateDB(db, storeName,lxDatas).then(msg=>{
          console.log('离线保存',lxDatas,JSON.stringify(msg))
          plus.nativeUI.closeWaiting();
          if(msg.isTrusted){
            mui.toast("保存成功")
            mui.fire(self.opener(), 'back', {
              back: 1
            })
            let listPage = plus.webview.getWebviewById('./riskList.html')
            let detailPage = plus.webview.getWebviewById('./carryoutToDoDetail.html')
            if (listPage) {
				mui.fire(listPage, 'back', {}) 
			}
            if (detailPage) { 
				mui.fire(detailPage, 'back', {})
			}
            if (!num) {
              mui.back()
            }
          }else{
            mui.toast("保存失败")
          }
             
        }).catch(err=>{
          mui.toast("保存失败")
        })
      }
	  function getDel(id){
	    deleteDB(db, storeName, id)
	  }
      function getSysInfo() {
		// return false

		types = {};
		types[plus.networkinfo.CONNECTION_UNKNOW] = "未知";
		types[plus.networkinfo.CONNECTION_NONE] = "未连接网络";
		types[plus.networkinfo.CONNECTION_ETHERNET] = "有线网络";
		types[plus.networkinfo.CONNECTION_WIFI] = "WiFi网络";
		types[plus.networkinfo.CONNECTION_CELL2G] = "2G蜂窝网络";
		types[plus.networkinfo.CONNECTION_CELL3G] = "3G蜂窝网络";
		types[plus.networkinfo.CONNECTION_CELL4G] = "4G蜂窝网络";

		var str = types[plus.networkinfo.getCurrentType()];
		if (str == '未知' || str == '未连接网络') {
		  return false;
		} else {
		  return true;
		}
       
      }
      mui("body").on('change', '.isAnomaly input[type=radio]', function() {
        var v = $(this).val();
        $(this).attr('checked', true)
        if (v == 1) {
          vm.detail.isAnomaly = true
          vm.fileimg = true
        } else {
          vm.detail.isAnomaly = false
          vm.fileimg = false
        }
      });

      $(document).ready(function() {
        let height = document.documentElement.clientHeight
        //防止软键盘弹出底部按钮顶上来
        $(".mui-content").css('height', height + 'px')
      })
      $("#sign").click(function() {
        // mui.baseApp.openWindow('../common/sign.html')
      })
      window.addEventListener('sign', function(event) {
        let data = event.detail
        fileId = data.fileId
        vm.signInfo.signImg = data
        console.log('图片123456', data)

        $("#signImg").attr('src', data.img)
        $("#signImg").show()
      });

      function fileUrl(datas) {
        fileId = datas.fileId
        vm.signInfo.signImg = datas
        // $("#signImg").attr('src', datas.img)
        // vm.signInfo.signImg.filePath=datas.img
        mui.baseApp.base64ToPath(datas.img).then(res => {
          console.log('图片', res)
          vm.signInfo.signImg.filePath = res

        })
      }
      window.addEventListener('faultInfo', function(event) {
        let data = event.detail
        console.log('缺陷', data)
        vm.detail.isFault = true
        faultInfo = data.faultInfo
        vm.faultInfo = data.faultInfo
		
		
      });
      window.addEventListener('materialsthis', function(event) {
        let data = event.detail
        console.log('返回物料数据', data)
        materialsthis = data.materialsthis
        vm.materialsthis = data.materialsthis
      });
    </script>
  </body>
</html>
